package com.bum.api.processor.dj.json.bo;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.math.NumberUtils;

import com.bum.api.bo.DjGuruBO;
import com.bum.api.core.exp.om.Metas;
import com.bum.api.core.exp.om.Params;
import com.bum.guru.exp.dj.om.Song;
import com.google.gson.Gson;

public class DjJsonBO {
	Gson		gson;
	DjGuruBO	djGuruBO;

	public String streams(String path, Params params, Metas metas) {
		long id = NumberUtils.toLong(path, 0);

		Song song = null;
		if (id > 0) {
			song = djGuruBO.get(id);
		}

		Map item = null;
		if (song != null) {
			item = new HashMap();
			item.put("title", song.getName());
			item.put("m4a", song.getUrlStream());
		}
		return gson.toJson(Arrays.asList(item));
	}

	public void setDjGuruBO(DjGuruBO djGuruBO) {
		this.djGuruBO = djGuruBO;
	}

	public void setGson(Gson gson) {
		this.gson = gson;
	}
}
